<script type="text/javascript">
    $(function() {        
        $("a.add").button({
            icons: {
                primary: "ui-icon-plusthick"
            }
        });
        
        $("a.back").button({
            icons: {
                primary: "ui-icon-circle-arrow-w"
            }
        });

        $('.search input[type="submit"]').hide();

        $('#search_keywords').keyup(function(key){
            if (this.value.length >= 1){
                $('#loader').show();
                $.ajax({
                   type: 'post',
                   url: $(this).parents('form').attr('action'),
                   data: { 
                       query: this.value == '' ? '*' : this.value,
                       categories: [<?php echo $category->getId() ?>]
                   },
                   success: function(data){
                       $('#list').html(data)
                   }
                });
            }
        }); 
    });
</script>
<div class="search">
    <form action="<?php echo url_for('category_candidate_search', $category) ?>" method="post">
        <label>Buscar por nombre o descripción: </label>
        <input type="text" name="query" value="<?php echo $sf_request->getParameter('query') ?>" id="search_keywords" />
        
        <input type="submit" value="search" />
        <img id="loader" src="/images/loader.gif" style="vertical-align: middle; display: none" />
    </form>
</div>

<?php include_partial('candidatesList', array('pager' => $pager, 'category' => $category))?>

<hr>

<a class="back" href="<?php echo url_for('category_show',$category) ?>">Regresar</a>
&nbsp;
<a class="add" href="<?php echo url_for('candidate_new') ?>">Nuevo Candidato</a>
